import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_base_framework/flutter_base_framework.dart';

class LoadingDialog extends Dialog {
  ///加载提示
  final String loadingText;

  LoadingDialog({this.loadingText = '加载中...'});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Material(
        color: Colors.transparent,
        child: Center(
          child: Container(
            width: 200.dp,
            height: 200.dp,
            decoration: ShapeDecoration(
              color: Color(0x99000000),
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(
                  Radius.circular(8.dp),
                ),
              ),
            ),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                CircularProgressIndicator(
                  valueColor: AlwaysStoppedAnimation(
                    Colors.white,
                  ),
                  strokeWidth: 2.0,
                ),
                Get.heightBox(15.dp),
                Text(
                  loadingText,
                  style: TextStyle(fontSize: 15.0, color: Colors.white),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}